function varitest(time,Y,T,type,casenum,num)
%function varitest(time,Y,T,type,casenum,num)
%load('orthbase');

switch type
    case 'single'
        switch casenum
            case 'const'
                exactvar=time;
            case 'sint'
                exactvar=time/2-1/4*sin(2*time);
            case 'sin5t'
                exactvar=time/2-1/20*sin(10*time);
            case 'sin30t'
                exactvar=time/2-1/120*sin(60*time);
            case 'nonsimple'
                exactvar=zeros(num+1,1);
                myfun=@(s) sin(exp(5*s)).^2;
                for ii=2:num+1
                    exactvar(ii)=quadl(myfun,0,time(ii));
                end
%     case 'nonsimple'
%         exactvar=zeros(num+1,1);
%         myfun=@(s) sin(exp(s)).^2;
%         for ii=2:num+1
%             exactvar(ii)=quadl(myfun,0,time(ii));
%         end
        end
    case 'uncorrelated'
        switch casenum
            case 'oudt'
                exactvar=0.04*ones(size(time));
        end
end
hold on
tmp=zeros(size(Y(:,1)));
for ii=1:size(Y,2)
    tmp=tmp+Y(:,ii);
end
plot(time,tmp,'r-');
time=linspace(0,T,num+1);
plot(time,exactvar);
title('Variance')
legend('wce var','exact var');